package cn.weiron.fun.infrastructure;

import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.weiron.fun.infrastructure.utils.SendSMSUtils;

import java.util.List;

/**
 * Description:
 *
 * @author : value
 * @Date : 2022/4/22
 */
public class SmsSendThread implements Runnable{

    private final List<String> phones;

    private final String content;

    public SmsSendThread(List<String> phones,String content){
        this.phones = phones;
        this.content = content;
    }
    @Override
    public void run() {
        if(StrUtil.isBlank(content)|| CollectionUtil.isEmpty(phones)){
            return;
        }
        String phonesList = StrUtil.join(",", phones);
        SendSMSUtils.sendBatchSMS(phonesList,content);
    }
}
